﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    enum yingxiong { 
        刘备=1,
        孙权,
        曹操
    }
    enum jdstb { 
        剪刀=1,
        石头,
        布
    }
    class Program
    {
        static string str;
        static int a;
        static void Main(string[] args)
        {
            jy();
        }

        private static void jy()
        {
            Console.WriteLine("--------------欢\t迎\t进\t入\t游\t戏\t世\t界--------------");
            Console.WriteLine("******************************");
            Console.WriteLine("**********猜拳，开始**********");
            Console.WriteLine("******************************");
            Console.WriteLine("出拳规则：1.剪刀 2.石头 3.布");
            Console.WriteLine("请选择对方角色<1：刘备 2：孙权 3：曹操>");
            a = int.Parse(Console.ReadLine());
            yingxiong b = (yingxiong)a;
            Console.WriteLine("请输入您的姓名：");
             str = Console.ReadLine();
            Console.WriteLine("{0}  vs  {1}  对战", str, b);
            Console.WriteLine("开始游戏吗？<y/n>");
            string key = Console.ReadLine();
            switch (key)
            {
                case "y":
                    //Console.WriteLine("请出拳：1.剪刀 2.石头 3.布（输入相应数字：）");
                    //int quan = int.Parse(Console.ReadLine());
                    //jdstb p = (jdstb)quan;
                    //Console.WriteLine("{0}：出拳：{1}", str, p);
                    //Random ran = new Random();
                    //int d = 1 + ran.Next(3);
                    //jdstb s = (jdstb)d;
                    //Console.WriteLine("{0}：出拳：{1}", b, s);
                    //if (quan==d) {
                    //    Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                    //}
                    jy1();
                    break;
                case "n":
                    jy2();
                    break;
                default:
                    break;
            }
        }
        private static void jy1()
        {
            Console.WriteLine("请出拳：1.剪刀 2.石头 3.布（输入相应数字：）");
            int quan = int.Parse(Console.ReadLine());
            jdstb p = (jdstb)quan;
            Console.WriteLine("{0}：出拳：{1}", str, p);
            Random ran = new Random();
            int d = 1 + ran.Next(3);
            jdstb s = (jdstb)d;
            yingxiong b = (yingxiong)a;
            Console.WriteLine("{0}：出拳：{1}", b, s);
            if (quan == d)
            {
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                xyl();
            }
            else if (quan == 1 && d == 2 || quan == 2 && d == 3 || quan == 3 && d == 1)
            {
                Console.WriteLine("傻逼{0},人机都玩不过！！！", str);
                xyl();
            }
            else if (quan == 1 && d == 3 || quan == 2 && d == 1 || quan == 3 && d == 2)
            {
                Console.WriteLine("恭喜{0},赢了！！！", str);
                xyl();
            }
            else {
                Console.WriteLine("输入错误");
            }
        }

        private static void xyl()
        {
            Console.WriteLine("是否开始下一轮？<y/n>");
            string key = Console.ReadLine();
            switch (key)
            {
                case "y":
                    jy1();
                    break;
                case "n":

                    break;
                default:
                    break;
            }
        }

        private static void jy2()
        {
        }


        

        
    }
}
